function saveData(data ,errorType) {
    let xhr = new XMLHttpRequest();
    xhr.open('post', 'http://localhost:3000/'+errorType);
    xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xhr.send(`${errorType}=${JSON.stringify(data)}`);
    xhr.onreadystatechange = function(){
        if(xhr.readyState == 4 && xhr.status == 200){
            console.log('success');
        }
    }
}

export default function (data,errorType) {
    saveData(data,errorType);
}
